﻿using Microsoft.EntityFrameworkCore;
using SimpleWebApi.Business.Service.Interface;
using SimpleWebApi.MyMigration.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SimpleWebApi.Business.Service
{
    public class CommodityService : BaseService, ICommodityService
    {
        public CommodityService(DbContext context) : base(context)
        {

        }

        public bool AddCommodity(Commodity commodity)
        {
            this.Context.Set<Commodity>().Add(commodity);
            int num = this.Context.SaveChanges();
            return num > 0;
        }

        public IQueryable<Commodity> GetCommodity(int Id)
        {
            var list = this.Context.Set<Commodity>().Where(a => a.Id == Id);
            return list;
        }
    }
}